Automatic visual inspection system

ABSTRACT

A binary map of an object having edges is produced by first producing a digital grey scale image of the object with a given resolution, and processing the grey scale image to produce a binary map of the object at a resolution greater than said given resolution. Processing of the grey scale image includes the step of converting the 2-dimensional digital grey scale image with a filter function related to the second derivative of a Gaussian function forming a 2-dimensional convolved image having signed values. The location of an edge in the object is achieved by finding zero crossings between adjacent oppositely signed values. Preferably, the zero crossings are achieved by an interpolation process that produces a binary bit map of the object at a resolution greater than the resolution of the grey scale image. The nature of the Gaussian function whose second derivative is used in the convolution with the grey scale image, namely its standard deviation, is empirically selected in accordance with system noise and the pattern of the traces on the printed circuit board such that the resulting bit map conforms as closely as desired to the lines on the printed circuit board. 
     The convolution can be performed with a difference-of-two Gaussians, one positive and one negative. It may be achieved by carrying out a one-dimensional convolution of successive lines of the grey scale image to form a one-dimensional convolved image, and then carrying out an orthogonal one-dimensional convolution of successive lines of the one-dimensional convolved image to form a two-dimensional convolved image. Each one-dimensional convolved image may be formed by multiple convolutions with a boxcar function.

RELATED APPLICATIONS

This application is a continuation-in-part of application Ser. No.061,344 filed May 17, 1993, now U.S. Pat. No. 5,774,572, which is acontinuation of application Ser. No. 961,070 filed Oct. 14, 1992 (nowabandoned), which is a continuation of application Ser. No. 804,511filed Dec. 10, 1991 (now abandoned), which is a continuation ofapplication Ser. No. 684,583 filed Dec. 20, 1984 (now abandoned). Thesubject matter in the parents of the present application is herebyincorporated by reference.

TECHNICAL FIELD OF THE INVENTION

This invention relates to automatic visual inspection systems, and moreparticularly to systems for inspecting printed circuit boards, hybridboards, and integrated circuits.

BACKGROUND OF THE INVENTION

In its simples form, a printed circuit board or panel comprises anon-conductive substrate on one or both surfaces of which are depositedconduit tracks or lines in a pattern dictated by the design of theelectronic equipment supported by the board. More complex boards areconstructed by laminating a number of single panels into a composite ormulti-layered board; and the use of the latter has increaseddramatically in recent years and an effort to conserve space and weight.

As component size has shrunk, component density on boards has increasedwith the result that line size and spacing have decreased over theyears. Because of the “fine geometry” of modern boards, variations inline width and spacing have become more critical to proper operation ofthe boards. That is to say, minor variation in line thickness or spacinghave a much greater chance to adversely affect performance of theprinted circuit board. As a consequence, visual inspection, theconventional approach to quality control, has employed visual aids, suchas magnifiers or microscopes, to detect defects in a board during itsmanufacturer. Such defects would include line width and spacing, padposition relative to hole location, etc. Unfortunately, visualinspection is a time consuming, tedious task that causes operatorfatigue and consequential reduction in consistency and reliability ofinspection, as well as throughput.

Because multi-layered boards cannot be tested electrically beforelamination, visual inspection of the component panels of a multi-layeredboard before lamination is critical. A flaw in a single layer of anassembled board can result in scrapping of the entire board, or involvecostly, and time consuming rework. Thus, as board complexity andcomponent density and production requirements have increased, automationof manufacturing processes has been undertaken. However, a larger andlarger fraction of the cost of producing boards lies in the inspectionof the boards during various stages of manufacture.

Automatic visual inspection techniques have been developed in responseto industry needs to more quickly, accumulately and consistently inspectthe printed circuit boards. Conventional systems include anelectro-optical sub-system that intensely illuminates a board beinginspected along a narrow strip perpendicular to the linear displacementof the board through the system, and a solid state camera that convertsthe brightness of each elemental area of the illuminated strip, termed apixel, to a number representative of such brightness; and the number isstored in a digital memory. Scanning of the entire board is achieved bymoving the board relative to the camera. The result is a grey scaleimage of the board, or part of the board stored in memory. A relativelysmall number in a cell of the memory represents a relatively dark regionof the object (i.e., the substrate), and a relatively large numberrepresents a brighter portion of the object, (i.e., a conductive line).

The contents of the memory are processed for the purpose of determiningthe location of transitions between bright and dark regions of theobject. Such transitions represent the edges of lines and the processingof the data in the digital memory is carried out so as to produce whatis termed a binary bit map of the object which is a map of the printedcircuit board in terms of ZERO's and ONE's, where the ONE's trace thelines on the printed circuit board, and the ZERO's represent thesubstrate. Line width and spacing between lines can then be carried outby analyzing the binary map.

The time required to scan a given board, given a camera with apredetermined data processing rate, typically 10-15 MHz, will depend onthe resolution desired. For example, a typical camera with an array of2048 photodiodes imaging a board is capable of scanning a one inchswarth of the board in each pass if a resolution of ½ mil is required.At 0.5 mil resolution, a swath one inch wide is composed of 96 millionpixels. Assuming camera speed of 10 MHz, about 10 seconds would berequired for completing one pass during which data from one swath wouldbe acquired. If the board were 18 inches wide, then at least 18 passeswould be required to complete the scan of the board. More than 18 passesis required, however, to complete a scan of the board because an overlapof the passes is required to insure adequately covering the “seams”between adjacent passes. Combined with overhead time required, e.g., thetime required to reposition the camera from swath to swath, dataacquisition time becomes unacceptably large under the conditionsoutlined above.

The basic problems with any automatic visual inspection system can besummarized in terms of speed of data acquisition, amount of light toilluminate the board, and the depth of field of the optical system.Concomitant with increased requirements for reducing pixel size (i.e.,increasing resolution) is an increase in the amount of light that mustbe supplied to a pixel to maintain the rate of data acquisition.Physical constraints limit the amount of light that can be concentratedon the printed circuit boards so that decreasing the pixel size toincrease resolution and detection variations in line width or spacing of“fine geometry” boards, actually slows the rate of data acquisition.Finally, decreasing pixel size, as resolution is increased, isaccompanied by a reduction in the depth of field which adversely affectsthe accuracy of the acquired data from board to board.

It is therefore an object of the present invention to provide a new andimproved automatic visual inspection system which is capable ofacquiring data faster than conventional automatic visual inspectionsystems, and/or reducing the amount of illumination required for theboard, and increasing the depth of field.

It is a further object of the present invention to provide a new andimproved automatic visual inspection system which is capable ofaccurately interpreting information when the object being inspected hasregions of different contrast, precision of focus, and other surfaceconditions.

BRIEF DESCRIPTION OF INVENTION

According to the present invention, a binary map of an object havingedges is produced by first producing a digital grey scale image of theobject with a given resolution, and processing the grey scale image toproduce a binary map of the object at a resolution greater than saidgiven resolution. If the ultimate resolution required is, for example,one mil (0.001 inches), then, the resolution of the digital grey scaleimage can be considerably less than one mil, and may be, for example,three mils. The larger than final pixel size involved in acquiring datafrom an object permits objects to be scanned faster, and either reducesthe amount of light required for illuminating the objects or permits thesame amount of light to be used thus decreasing the effect on accuracyof noise due to statistical variations in the amount of light. Finally,increasing the pixel size during data acquisition improves the depth offield and renders the system less sensitive to variations in thethickness of the boards being tested.

Processing of the grey scale image includes the step of convolving the2-dimensional digital grey scale image with a filter function related tothe second derivative of a Gaussian function forming a 2-dimensionalconvolved image having signed values. The location of an edge in theobject is achieved by finding zero crossings between adjacent oppositelysigned values. Preferably, the zero crossings are achieved by aninterpolation process that produces a binary bit map of the object at aresolution greater than the resolution of the grey scale image. Thenature of the Gaussian function whose second derivative is used in theconvolution with the grey scale image, namely is standard deviation, isempirically selected in accordance with system noise and the pattern ofthe traces on the printed circuit board such that the resulting bit mapconforms as closely as desired to the lines on the printed circuitboard.

The convolution can be performed with a difference-of-two-Gaussians, onepositive and one negative. It may be achieved by carrying out aone-dimensional convolution of successive lines of the grey scale imageto form a one-dimensional convolved image, and then carrying out anorthogonal one-dimensional convolution of successive lines of theone-dimensional convolved image to form a two-dimensional convolvedimage. Each one-dimensional convolved image may be formed by multipleconvolutions with a boxcar function.

Detection of the presence of lines less than predetermined minimum widthcan be accomplished, independently of the attitude of the lines in thebit map by superimposing on an edge of a line, a quadrant of a circlewhose radius is the minimum line thickness. By ANDing he contents ofpixels in the bit map with ONE's in the corresponding pixels in thesuperposed quadrant the production of a ZERO indicates a line width lessthe predetermined width. A similar approach can be taken to detect linespacings less than a predetermined minimum. One quadrant is used forlines and spaces whose are oriented on the board lies between 0° and90°, and another quadrant is used for orientations between 90° and 180°.

The processing of the grey scale image by convolving with the filterfunction of the present invention produces a binary map of the object interms of transitions between brighter and dimmer elements in the object.To complete the map, the non-transition pixels must be assigned binaryvalues that match the nature of the homologous pixels in the object.That is to say, all of the pixels that define traces should have thesame binary value, and all of the pixels that define the substrate havethe opposite binary value.

The present invention utilizes a threshold function in establishing anattribute of each pixel in the grey scale object. Such attribute assistsin the assignment of binary values to the pixels in the binary map ofthe object. In one aspect of the invention, the threshold function is aconstant function of grey level and is location independent, and inanother aspect of the invention, the threshold function is anon-constant function of grey level and is location dependent.

BRIEF DESCRIPTION OF DRAWINGS

An embodiment of the present invention is shown in the accompanyingdrawings wherein:

FIG. 1 is a plan view of a segment of a typical printed circuit board.

FIG. 2 is a section taken along the line 2—2 of FIG. 1 showing a crosssection of the printed circuit board in FIG. 1;

FIG. 3 shows two portions of a printed circuit board for the purpose ofillustrating a line of reduced width and for illustrating the spacingbetween adjacent lines;

FIG. 4 is a composite view of a portion of a grey scale image of aprinted circuit board for the purpose of showing the effect of an edgeon the grey scale image, and showing the bit map values for the sectionillustrated;

FIG. 5 is a block diagram schematically illustrating the automaticvisual inspection system according to the present invention;

FIG. 6 is a composite view similar to that of FIG. 4 but illustratingthe variation in grey scale values resulting from an edge of a line on aprinted circuit board, and showing the distribution of the signed valuesof the convolved image as well as the values of the bits assigned to thebit map for both the measured and interpolated pixel values;

FIG. 7 is a sketch illustrating the manner for identifying the pixelcontaining the zero crossing between adjacent oppositely signed valuesof the convolved image;

FIG. 8 is a plan view of a number of pixels illustrating how theinterpolation process is carried out in two-dimensions;

FIG. 9 is an enlarged view of a bit map for the purpose of illustratinga line having a width less than the prescribed width, and the manner inwhich detection of this defect is achieved using a quadrant whose radiusis equal to the prescribed minimum line width; and

FIG. 10 is a schematic diagram of an one embodiment of apparatus bywhich a 2-dimensional convolution can be carried out on grey scale imagedata to form a convolved image;

FIG. 11 is another embodiment of convolver;

FIG. 12 is a cross-section of a typical printed circuit board showingconductive traces in regions of different contrast between a conductivetrack and the substrate, and showing the effect on the measuredreflectance;

FIG. 13 shows a 3×3 matrix of pixels in which the pixel underconsideration is the center pixel, and showing the four directionsinvolved in obtaining an ordered pair of numbers for the center pixel;

FIG. 14 is the grey-level-difference/grey-level plane showing therelationship between the coordinates of a given pixel in this plane anda threshold function obtained during a calibration operation for thepurpose of assigning an attribute to the pixel;

FIG. 15 is flow chart that shows the off-line calibration procedure toobtain a threshold function of the present invention;

FIGS. 16 and 17 are various 3×3 matrices of pixels showing some of thecombinations of transition and non-transition pixels which,respectively, represent probable edges and not-probable edges which areused during the calibration operation;

FIGS. 18 and 19 show examples of good and bad contours, respectively, inthe binary map produced by the convolution process, and used during thecalibration operation;

FIG. 20 shows how a threshold function is derived from the ordered pairsof numbers associated with pixels from good and bad contours during thecalibration operation;

FIG. 21 is a block diagram of a second embodiment of the presentinvention for binarization of a grey level map;

FIG. 22 is a flow chart showing an initial step in binarizationaccording to the present invention;

FIG. 23A represents a 3×3 array of pixels in the grey level map;

FIG. 23B is a flow chart showing the steps in obtaining an adjacencymap;

FIG. 24 is a flow chart showing the operational features of convolutionprocessor 200 in FIG. 21:

FIG. 25 is a flow chart showing the steps in obtaining the high-sure/lowmap in FIG. 24;

FIG. 26 is a flow chart showing the steps carried out in “painting”certain pixel according to FIG. 24; and

FIG. 27 is a flow chart showing the steps in the final revision of theconvolution map.

DETAILED DESCRIPTION

Referring now to the drawing, reference numeral 10 designates aconventional printed circuit board comprising substrate 11 on onesurface of which are deposited conductive tracks or lines 12 in a mannerwell known in the art. A typical board may have 3 mil lines, and spacingbetween lines of a comparative dimension.

As is well known, the technique of depositing lines 12 on substrate 11involves a photographic and etching process which may produce a resultshown in FIG. 3 where line 12a, of width w has a reduced portion at 12b.The cross section available for conduction in reduced portion 12b may beinsufficient to permit proper operation of the electronic componentsassociated with the printed circuit board; and for this reason a boardhaving a line of a width less than some predetermined value would berejected, or at least noted. As boards get more and more complex,detecting breaks in lines, or lines with reduced width, becomes more andmore difficult.

The photoetching process involved in producing lines on a printedcircuit board sometimes results in the spacing s being less that thedesign spacing. In such case, quality control should reject the board ornote the occurrence of a line spacing less than the specified linespacing.

In order to achieve these and other ends, conventional automatic visualinspection systems will produce the results shown in FIG. 4. That is tosay, a greyscale image of the printed circuit board will be obtained andstored in a digital memory, the resolution of the grey scale image beingselected to be consistent with the accuracy with which measurements inthe image are to be made. Thus, if the requirements is for measuring theedge 13 of a trace to within say 1 mil, then the resolution of the greyscale image should be less than that, say 0.5 mil.

Curve 14 in FIG. 4 illustrates the variation in brightness of pixelsmeasured by the electro-optical system of a conventional visualinspection system, the continuous analog values designated by curve 14being converted to discrete values by a sampling process which stores anumber in a homologous cell of a digital memory. The discrete values areindicated by circled-pluses in FIG. 4 and are designated by referencenumerals 15. Typically, due to noise and statistical variations in theamount of light incident on the printed circuit board, and otherfactors, edge 13 will cause curve 14 to vary continuously from agenerally lower level indicated by data points 19 to a generally upperlevel as indicated by data points 20, rather than to jump, in adiscontinuous manner, from one level to the other. Thus, edge 13 is notsharply defined.

Conventionally, an algorithm is used for the purpose of determiningwithin which pixel an edge will fall and this is illustrated by theassigned pixel values in vector 18 as shown in FIG. 4. That is to say,value 15a is assumed to exceed a predetermined threshold; and where thisoccurs, a bit map can be established based on such threshold in a mannerillustrated in FIG. 4. Having assigned binary values to the bit map, theedge is defined as illustrated by curve 16 in FIG. 4.

One of the problems with the approach illustrated in FIG. 4 is themanner in which the bit in position 17 in bit map vector 18 is assigned.The precise location of the transition from the printed circuit board,as indicated by measured brightness value 19 to a line indicated bymeasure value 20, depends on the value at 15A and the size of thepixels.

In other words, for a given pixel size, identifying the transition asoccurring at location 17 in the bit map rather than at adjacent location21, depends upon the selected threshold. Note that the pixel size of thegrey scale image in the prior art is the same as the pixel size in thebit map.

The present invention contemplates using larger pixels to acquire thegrey scale image of the printed circuit board than are used inconstructing the bit map while maintaining resolution accuracy. Usingrelatively large pixels to acquire the data increases the area scannedby the optical system in a given period of time as compared to theapproach taken with a conventional device. This also increases theamount of light incident on each pixel in the object thus decreasing theeffect of noise due to statistical variations in the amount of lightincident on the pixel. Finally, this approach also increases the depthof field because of the larger pixel size accommodating largerdeviations in board thickness.

Apparatus in accordance with the present invention is designated byreference numeral 30 and is illustrated in FIG. 5 to which reference isnow made. Apparatus 30 is designed to produce a binary bit map ofprinted circuit board 31 which has lines thereon defining edges as shownin FIG. 1. Apparatus 30 comprises a conventional electro-opticalsub-system 32 for producing data representative of the brightness of thesurface of printed circuit board 31, and processing means 33 forprocessing the data and producing binary bit map stored in memory 34.Board 31 is mounted for linear displacement in the direction indicatedby arrow 35, the mechanism for effecting the movement being conventionaland not forming a part of the present invention. For example, movabletables are available having vacuum tops by which the printed circuitboard is clamped for movement by the table.

Linear light source 36, shown in cross-section in FIG. 5, produces highintensity beam 37 which illuminates strip 38 on surface 39 of theprinted circuit board, strip 38 being oriented in a directionperpendicular to the direction of movement of the board. Light from thestrip is focused by optical system 40 onto a linear array ofphotodectors 42 each of whose instantaneous outputs on bus 43 isrepresentative of the number of light photons incident on thephotosensitive area of a photodetector. The outputs of thephotodetectors are integrated over time, for example, by a linear arrayof charge-coupled-detectors (CCD's) 44 on which charge is accumulated inproportion to the amount of light incident on the photodetectors, andthe time of accumulation which is established by the sampling of theCCD's. In other words, after a predetermined amount of time dependentupon the intensity of light source 36 and the speed of movement of board31 and the optical condition of surface 39 of the printed circuit board,each CCD in array 44 will have a charge whose magnitude is proportionalto the brightness of an elemental area on strip 38 within the field ofview of the particular photodetector connected to the CCD. Upon samplingof the CCD's after such predetermined time, the values of the charges onthe linear array of CCD's 44 are transferred, to compensation circuit45. The arrangement is such that data corresponding to the brightness ofeach pixel in the object is sequentially examined by compensationcircuit 45, and a correction is applied to each value to compensate forindividual response of the various photodiodes in array 42. The need forsuch compensation arises because the outputs of photodetectors 42, whena uniformly bright object is scanned, will in general, not be equal. Thevariation in outputs from pixel to pixel in the line of data applied tocircuit 45, when the object is uniformly bright, is due to difference inthe gain and the response slopes of the photodetectors. By carrying outa calibration process that involves scanning a uniformly bright object,a look-up table of correction factors for the output of eachphotodetector can be stored in memory 46. In this way, a correction ofunavoidable non-uniformities in the illumination and corrections for thebias and the gain differences for the output of each photodetector canbe applied to the data being supplied to circuit 45 thus eliminatingvariations in the electrical responses of the photodetectors.

The output of circuit 45, which is serial, is a representation of thegrey scale image of the object, namely surface 39 of board 31. This greyscale image is developed line by line as board 31 is moved with respectto the electro-optical sub-system 32. The function of preprocessor 70 isdeferred; and at this time, it is sufficient to state that the digitalvalues of the brightness of the elemental areas of the object are storedin a digital memory that is a part of convolver 47 whose operation isdetailed below.

Referring at this time FIG. 6, sampled data points 48, 49, represent thebrightness of pixels on board 11, such pixels being 9-time larger inarea than the sampled pixels according to the prior art as shown in FIG.4. This tripling of the pixels dimension is for purposes of illustratingthe present invention and should not be considered as a limitationbecause the pixel size could be made any multiple of the pixel sizeshown in FIG. 4. For example, the increase in pixel size could be by afactor of 5 or even 10 times. That is to say, the resolution of the greyscale image obtained according to the present invention is ⅓ or lessthan the resolution of the grey scale image of a conventional system.Although, as indicated below, the image with the larger pixels appearmore blurred than the image with smaller pixels, the processing carriedout by convolver 47 properly locates edges of lines on the printedcircuit board. However, because the pixel size is increased over that asshown in FIG. 4, the speed of scanning can be increased by the square ofthe factor that the resolution is decreased, or the amount of lightcould be reduced and achieve the same scanning rate. In addition, theundersampling achieved with the present invention beneficially effectsthe field of depth of the optical system with the result that the greyscale image is less sensitive to variations in printed circuit boardthickness as different printed circuit boards are scanned, or tovariations in height within the same board itself.

Convolver 47 carries out, on the digital data representative of the greyscale image of the printed circuit board, a two-dimensional convolutionwith the second derivative of a Gaussian function, or an approximationthereof, producing in the associated memory of the convolver, aconvolved image of the object having signed values. FIG. 6 shows aone-dimensional convolution of the measured grey scale image representedby data points 48-51 producing the signed values 52-55 shown in FIG. 6.In other words, the convolved one-dimensional image has essentially zerovalues indicated by data points 52 and 55 at all locations where thebrightness of the grey scale image is substantially constant (i.e.,regions of the substrate and regions of a line). Thus, theone-dimensional convolved image of the printed circuit board will havevalues close to zero throughout the image except at the edge of a line.Such an edge is indicated in the one-dimensional convolved image bytransitions that have large excursions above and below a zero level asindicated in FIG. 6 by data points 53 and 54. The actual location of theedge is determined by the zero crossing of the signed values of theconvolved image. The crossing is closely related to the location wherelinear curve 56 connecting data points 52-55 crosses the zero axis, thecrossing point being indicated by reference numeral 57.

The precise location of the zero crossing need not be determined, onlythe pixel within which the crossing occurs is necessary. In order tomake a direct comparison with the conventional technique illustrated inFIG. 4, the number of pixels in the bit map that will be reproducedusing the convolved image is increased to correspond to the number ofpixels in the bit map used with the conventional apparatus. Thus, whiledata points 63 and 54 are measured data points, intermediate points 58,59, equally spaced between the measured data points, can be found by alinear interpolation operation. The problem of finding the zero crossingis simplified because, as explained below, identification of the pixelin which the zero-crossing occurs is achieved by a comparison of thevalues of data points 53 and 54.

Reference is now made to FIG. 7 which illustrates the manner in which acomparison is made between the signed data points for the purpose oflocating that pixel containing the zero crossing of the convolved image.Recalling that the distance between measured data points is divided intoa number of intervals to reduce pixel size in the bit map (in thisexample, the pixel dimension in the bit map is ⅓ of the dimension in thegrey scale image), location of the zero crossing involves identifyingpixel in which the zero crossing occurs. Inspection of FIG. 7 revealsthat, by reason of similarity of triangles:

A/B=b/(3a−b)   (1)

where where the quantity A represents the magnitude of the convolvedimage at 54, B represents the magnitude of the convolved image at datapoint 53, a represents the dimension of a pixel, and b represents thedistance of the zero crossing from data point 54. The object of thisexercise is to assign a binary value to bits associated with data points53 and 54, as well as the two interpolated data points 58 and 59. Thebinary values for data points 54 and 53 are known and they are ZERO andONE respectively as shown in FIG. 7. What is unknown is the valueassociated with the interpolated data points 58 and 59, these valuesbeing indicated by the quantities x₁ and x₂. By inspection of Eq. (1),one can see that if b lies within the interval between zero and a asshown in FIG. 7, then 2A is less than or equal to B. In such case, thezero crossing would occur between data points 54 and 59 and theconsequence is that both x₁ and x₂ should have the binary value 1.Similarly, if A is greater than or equal to 2B, then x₁=0 and x₂=0.Finally, if B/2<A2B, then x₁=0 and x₂=1. The nature of convolving withthe derivative of the Gaussian is such that near a zero-crossing, theconvolved image varies linearly. Therefore, the interpolation can becarried out quickly and simply. In order to determine the binary valuefor the final bit map from the convolved image, two rather simplearithmetic computations are carried out on adjacent oppositely signedvalues in the convolved image. Assignment of bit map values is dependentupon the inequalities discussed above.

Below curve 56 in FIG. 6 are two binary vectors, the vector at 60representing the binary values that result from the original grey scaleimage of the printed circuit board. Vector 61, on the other hand, isobtained using the technique described above using the interpolatedpixel values. The combined vectors produce the same vector as vector 18shown in FIG. 4 and also represent the curve 16 as indicated in FIG. 6.

In actual practice, a two-dimensional convolution of the grey scaleimage with a two-dimensional second derivative of a Gaussion is carriedout. The result is a two-dimensional convolved image of signed values;and interplation is carried on this convolved image as indicated in FIG.8 which shows measured data at points designated by circled-pluses, andinterplated data points designated by circled-dots. Interpolation iscarried out in orthogonal directions 62-63 and along diagonal 64 whichbisects the orthogonal directions. In each case, the interpolationidentifies that pixel within which the zero crossing has occurred in twoorthogonal directions and along a diagonal. This process is carried outpoint-by-point to complete the binary map.

Returning now to FIG. 5, interpolator and memory 65 carries out theoperation described above on the two-dimensional convolved imageproduced by convolver 47. The interpolation process produces binary bitmap 34 having pixel sizes that are the same as the binary bit mapproduced by the conventional approach taken in FIG. 4. However, thebinary bit map in FIG. 5 can be obtained almost an order magnitudefaster than the bit map following conventional procedures. Moreover, asindicated previously, the sensitivity of the apparatus to variationsfrom board to board, and/or within the same board, to board thickness isless pronounced than in the conventional device because the enlargedpixel size for acquiring the data increases the depth of fields of theoptical system.

As indicated previously, the signed values of the convolved image aredifferent from essentially zero only in the vicinity of transitions oredges in the object image. No information is contained in the convolvedimage by which a determination can be made that a pixel containing anessentially zero value is derived from a pixel associated with thesubstrate or from a pixel associated with a line. Thus, the edges oflines can be accurately determined by the process and apparatusdescribed above, but the attribute of pixels remote from an edge (e.g.,pixels farther than the radius of the derivative of the Gaussianoperator) is unknown. The purpose of pre-processor 70 is to furnish anattribute to interpolator 65 to enable it to assign a binary value toeach bit of the bit map in accordance with whether its correspondingpixel is located in a line or in the substrate. Thus, pre-processor 70applies to each pixel in the grey scale image a threshold test andstores in associated memory 71 a record that indicates whether thethreshold is exceeded. The threshold will be exceeded only for pixelslocated in a line on the printed circuit board. When convolver 47produces the convolved image of the grey scale image of the board, theaddress of each pixel lying in a line on the board is available frommemory 71. Thus, the attribute of each pixel in the bit map can beestablished. It is determined directly by the convolution sign near azero-crossing, and by the threshold test farther away from thezero-crossing. This is because unavoidable variations in contrast whichalways exist cause the threshold test to be inaccurate. This isparticularly true near an edge transition where large variations incontrast exist. In the method described here, therefore, the thresholdtest is used only for pixels completely surrounded by dark or lightareas. The attributes of pixels near the transition are determined, onthe other hand, directly by the convolution sign.

The present invention also contemplates determining whether any line onthe board has a portion with a thickness less than a predeterminedvalue, regardless of the orientation of the line relative to the axesdefining the pixel orientation. This result is achieved in the mannerillustrated in FIG. 9 which shows inclined line 72 of width w on aboard, the line having portion 73 of reduced width of less than apredetermined value. Fragment of bit map 74 shows line 72 as an islandof ONE's in a sea of ZERO's. To determine the line width at point 75 onthe line, pixel 75′ in the bit map is located, and a quadrant ofimaginary circle 76 of radius equal to the required line width issuperimposed on the bit map, the apex of the quadrant being positionedat pixel 75′. The circle is defined by address offsets from selectedpixel 75′. That is to say, given the address of a pixel on the edge of aline, the addresses of pixels within the boundary of circle 76 is known.If all of the pixels in the bit map within the boundary of circle 76contain a ONE, then the width of the line at the selected point is noless than the required minimum line width. On the other hand, if any ofthe pixels within the boundary of circle 76 contain a ZERO, then thewidth of the line at the selected point is less than the requiredminimum. Note that the above description applies to line and spaceorientation between 0° and 180°.

In practice, analysis of line width can be carried out automatically bysequentially applying the principles set forth above to each point onthe edge of a line. A record can be made of each pixel in the bit map atwhich a ZERO detection occurs in the offset address, and hence thecoordinates of each point on the board having too narrow a line can bedetermined and stored. It should be noted that the technique disclosedherein is applicable to any line on the board at any orientation.

The principles described above are equally applicable to determiningwhether the spacing between lines is less than a predetermined minimum.In this case, however, the imaginary cycle is placed at at edge of aline such that it overlies the substrate, and the presence of a ONE inthe offset addresses indicates reduced spacing.

The convolution function used in the present invention need not be a2-dimensional function, and the convolution operation need not becarried out in one step. Rather, the function may be the difference ofGaussian functions, one that is positive, and one that is negative. Theconvolution operation can be carried out in two steps: convolving withthe positive Gaussian function, and then convolving with the negative.Implementing this, the effect of convolution can be achieved by multipleconvolving a a line of data in the grey scale image with a boxcarfunction in one dimension, and then convolving the 1-dimensionalconvolved image with a boxcar function in an orthogonal direction.

In order to facilitate two dimensional filtering, or the convolutionoperation as described above, apparatus 100 shown in FIG. 10 can beutilized. Apparatus 100 accepts a serial data stream from a scanned twodimensional function arranged in rows or columns with k elements per rowor per column. Such a signal is generated by a camera as describedabove.

The operation of apparatus 100 is based on a mathematical theorem thatstates that a 1-dimensional convolution of a given function with aGaussian function can be closely approximately by multiple 1-dimensionalconvolutions of the given function with a boxcar function (i.e., afunction that is unity between prescribed limits and zero elsewhere).This procedure is described in Bracewell, R. N. The Fourier Transformand Its Applications, McGraw-Hill Inc., 1978, chapter 8. Application ofthis theorem and its implementation to the grey-scale image of the boardis achieved in the present invention by apparatus 100 which comprises aplurality of identical convolver unit modules, only one of which(designated by numeral 101) is shown in detail. Each module accepts astream of values from a scanned two dimensional function, and performs apartial filtering operation. The output of that module is then fed tothe next module for further filtering.

Each module contains a shift register made of many (e.g., 2048) cellswhich are fed sequentially with a stream of grey level values from thecamera. Under control of pulses from a clock (not shown), the contentsof each cell is shifted (to the right as seen in FIG. 10) into theadjacent cell. The first step of the operation is to add two adjacentsamples in the input signal to the module. This is achieved by delayingthe input signal by one clock period using cell 103 and feeding itsoutput together with the input stream to adder 104 whose outputrepresent the boxcar function. The output of the adder may be delayed bycell 105, which is not essential for the correct operation of themodule, but may be included in order to improve speed of operation. Theoutput of cell 105 is down-shifted through shift register 102. Both theinput to and the output from shift register 102 are fed into secondadder 106 whose output is applied to last cell 107 which outputs thepartial result into the next module. This stage completes convolution ofthe input stream with a two-dimensional boxcar of size 2×2 pixels. Eachof cells 103, 105 and 107, and shift register 102 is pulsed by the sameclock. Several modules, for example nine, are cascaded in order toperform the required filtering on the input stream applied to convolverunit 1 whose input signal is a scanned two dimensional function of rowlength of k samples. The output stream from the last cascaded module isa 2-dimensional convolution of the grey scale image.

Another embodiment of convolver, shown in FIG. 11 by reference numeral110, carries out the same filtering functions as the apparatus shown inFIG. 10, except that the total delay through the circuit is different.Apparatus 110 comprises a plurality of horizontal and vertical convolverunits. If the number of horizontal units is made equal to the number ofvertical units, a symmetrical convolution is achieved. If the number ofunits in apparatus 110 is the same as in apparatus 100, the transferfunction will be exactly the same except for a fixed delay in the outputsignal.

The horizontal block of apparatus 110 contains m units, each of whichperforms partial horizontal filtering or convolution. Two adjacentsamples in cells 112 and 113 are summed by adder 114 which representhere the boxcar function. The output of the adder is fed into outputcell 115. Cascading many horizontal units performs a 1-dimensionalhorizontal filtering. The output of the horizontal block is then fedinto the vertical block.

The vertical block is made of identical units, each of which performspartial vertical filtering. Apparatus 116 shows one vertical unit. Thesignal is fed into the input cell 117. The output of that cell is downshifted along the shift register 118. Adder 119 adds the output of theshift register and the output of cell 117. The output of module 116 isfed into the input of the next module. The vertical modules perform a1-dimensional convolution on the output of the horizontal module,completing in this manner a 2-dimensional convolution on the grey-scaleimage. All memory cells in the vertical or horizontal units as well asall shift registers are pulsed by a common clock (not shown) feeding thevalue of each cell into the adjacent cell.

The above described apparatus performs repeating convolutions with aboxcar function comprised of two adjacent pixels, the convolution can beachieved using a boxcar function comprising more than two adjacentpixels. This can be achieved, for example, by increasing the number ofsampling cells and the number of shift registers, and consequently alsoincreasing the number of inputs entering the adders per module.

As previously indicated, the convolution process requires a2-dimensional convolution with the differences between Gaussianfunctions and this can be achieved in the manner indicated in FIGS. 10and 11, the size of the boxcar function (i.e., its limits along the lineof registers) is empirically selected to produce good correspondencebetween the bit map eventually produced and the actual board. While aline of data in the example described above is said to consist of 2048pixels, it should be clear that this number is by way of example onlyand represents the number of photodetectors used in conventionalscanning cameras. Furthermore, the 20-pixels window referred to aboveshould also be considered as being an example because other windows, oreven no window at all, can be used.

Finally, while the invention has been described in detail with referenceto optical scanning of printed circuit boards, the inventive concept isapplicable to other optical scanning problems, and more generally, toany 2-dimensional convolution problem. For example, the invention can beapplied to inspecting hybrid boards as well as integrated circuits.

As described above, compensation circuit 45 supplies information topre-processor 70 and memory 71 in order to effect conversion of theconvolution sign map in interpolator memory 65 to a binary map of anobject (e.g., a printed circuit board) in binary bit map 34 in order toaccurately depict edges or contours (e.g., tracks in the case of printedcircuit boards). The is process of conversion, called “binarization” ofthe pixels, may assign the value “ONE”, for example, to pixelsassociated with metal traces, and the value “ZERO” to pixels associatedwith the substrate.

In the embodiment shown in FIG. 5, binarization is effected using theoutput of pre-processor 70 which produces an attribute of the surface ofthe object for each homologous pixel in the grey scale image of theobject as supplied to the pre-processor by compensation circuit 45. Suchattribute establishes whether a pixel is part of a track or a part ofthe substrate. Specifically, the attribute is determined by comparingthe grey level of a pixel with a global threshold (i.e., a thresholdthat is the same for all pixels regardless of their location in themap). If the threshold old is exceeded, the conclusion is that the pixelis part of a track; and if not, the pixel is part of the substrate.These conclusions are based on recognizing that the conductive tracksreflect more light and appear brighter than the substrate.

With many printed circuit boards, binarization using a fixed thresholdapplied globally will produce satisfactory results. However, as printedcircuit boards become larger and more complex, and substrate materialmore exotic, it sometimes occurs that the grey scale value of a pixelfrom a metal element in one portion of a printed circuit board will havea value not significantly different from that of a pixel from asubstrate element in another portion of the board. That is to say, if asingle board has regions where the contrast between the tracks and thesubstrate differs, different thresholds would be required for theregions in order to obtain the proper attributes that would accuratelyreproduce all of the tracks on the board. The same situation occurs whenthe precision of focus of the optical system is different in differentregions of a printed circuit board. Additionally, the problem is presentwhen a single board contains regions of many fine, closely spacedtracks, and regions where the width of and spacing between the tracksare greater.

Reference is made to FIG. 12 to illustrate the problem of a single board300 containing region 301 in which the contrast between track 302 andthe substrate is lower than the contrast between track 303 and thesubstrate in region 304. In the graphs below board 300 in FIG. 14,sampled data points 305 represent the measured intensity of lightreflected from track 302 and the substrate during scanning of track 302in the direction indicated by arrow 306. Sampled data points 307represent the measured intensity of light reflected from track 303 andthe substrate during scanning. Typically, points 307 will be a familywhose lowest values may exceed the peak value of the the family ofpoints 305. Consequently, if threshold 308 were selected so as to besatisfactory for tracks in region 304, the threshold would be entirelyunsatisfactory for tracks in region 301 because tracks in region 301would not even appear in the final binary bit map.

Under the conditions described above, when fixed thresholding will notproduce satisfactory results, a second embodiment of the presentinvention can be utilized. In this embodiment, a two-step binarizationprocess is employed for classifying pixels as “white” (i.e., metal), or“black” (i.e., substrate).

In the first of the two-step process, those pixels capable of beingclassified unambiguously as either “white” or “black” are so classified,and the remaining pixels are tentatively classified as “other”. Thesecond step (called “painting”) classifies each of the “other” pixels aseither “white” or “black” by extending regions of pixels previouslyunambiguously classified as being “white” or black” according to presentrules.

Unambiguous classification of pixels is achieved in two ways. One wayinvolves identifying pixels near an edge or contour using grey-leveldata obtained by scanning. The other way involves identifying pixelsthat are surrounded by very high, or very low, grey-level values, andapplying of-line calibration information in deciding the classification.

Pixels near an edge can be identified based on large scale transitionsin grey scale values of adjacent pixels. Where such transitions occur inadjacent pixels, pixels with higher value grey scale values would beclassified unambiguously as “white”. Those with lower values would beclassified unambiguously as “black”.

For example, the grey scale map may contain a region where the greyscale level of the pixels changes abruptly from a low value, say 40-50units, to a high value, say 80-90 units which indicates an edge. In thisregion, pixels with values in excess of 80 units would be classified as“white”, and pixels with lower vales values would be classified as“black”. In another region of the map, the grey scale level of thepixels may change abrubptly from a relatively higher value, say 70-80units, to an even higher value, say 120 units of more indicating anedge. Insuch case, pixels with values of 80-120 units would beclassified as “black”, and pixels with values of 120 units or more wouldbe classified as “white”, etc.

As described in detail below, the first step in binarization accordingto the present invention involves comprising as ordered pair of numberstermed grey-level and grey-level differences for each pixel, and lookingfor sharp transitions. At locations where they occur, pixels areclassified as “black” and “white” unambiguously based on the convolutionvalues obtained as described previously. Negative convolution valuespermit unambiguous classification of the pixels as “black”; and positiveconvolution values permit unambiguous classification of the pixels as“white”.

Pixels surrounded by very high, or very low, grey-level values can beidentified directly from the grey-level values themselves. By carryingout an off-line calibrations that involves scanning a representativeprinted circuit board, the highest value of any substrate pixel can bedetermined. Any pixel, and its 3×3 neighbors, with an on-line grey levelvalue in excess of this calibration value, can be classifiedunambiguously as “white”. Similarly, any pixel, and its 3×3 neighbors,with an on-line grey level below the calibration value can be classifiedunambiguously as “black”.

By following the first classification step of the present invention, allof the pixels are classified into unambiguous “white”, unambiguous“black”, and “other” categories. The second classification step of thepresent invention extends the regions of the previously classified“black” and “white” pixels using a number of preset rules. For example,if a pixel p is classified as “other”, but its grey-level is lower thanthe grey level of a neighboring pixel q that is already classified as“black”, then pixel p will be classified as “black”, etc.

FIG. 13 illustrates the preferred manner of obtaining the ordered pairof numbers for each pixel in a grey scale map of an object. Referencenumeral 320 represents a typical grey scale pixel “A” for which anordered pair of numbers is to be obtained. Surrounding pixel 320 are itseight adjacent neighboring pixels designated pixels “B” to “T”. The greyscale level of each of these nine pixels is known by reason of thescanning process described above, and these grey scale levels are usedto compute the ordered pair of numbers. This is achieved by computingthe absolute value of the difference in grey levels in the two principle(i.e., orthogonal) directions labeled directions 1 and 2 in the drawing,and in the two diagonal directions labeled 3 and 4. In direction 1, thequantity Ig₁-g_(E)I, which is the absolute value of the difference ingrey level values for pixels “T” and “E” in FIG. 13, is computed, etc.In computing the absolute values in the diagonal directions, theabsolute values of the differences in grey-level values are normalizedby dividing the difference by 1,414 to take into account the differentdistances between pixels in the diagonal directions as compared with theprinciple directions.

The largest of the four absolute value difference identifies thedirection of greater change in grey level about the selected pixel “A”.In this direction, the average grey-level of the appropriate two pixelsis computed as (g_(avg))_(A), and the difference between the grey levelsof these pixels is computed as (d_(max))_(A). By following thisprocedure, an ordered pair of numbers g_(avg), d_(max) can be computedfor each pixel in the grey level map. The ordered pair of numbers soobtained for each pixel is plotted against a threshold function (T.F.)obtained by a calibration process that is described on detail below. Byits nature, the T.F. is dependent on the grey level of a pixel and itslocation. As shown in FIG. 14, the threshold function has the followinggeneral form:

for 0<(g_(avg))<G_(min), T.F.=D_(min)

(g_(avg))>G_(max), T.F.=D_(max)

G_(min)<(g_(avg))<G_(max), T.F.=step variation

where D_(min), D_(max), and the step variation are determined accordingto an off-line calibration process described below.

Point 321 represents the point on the grey-level/grey-level-differenceplane associated with pixel “A”. Because this point lies above thethreshold function 322, pixel “A” represents part of a track, and wouldbe assigned the value ONE in what is termed a gradient-enable binarymap. On the other hand, point 323, based on some other pixel, lies belowcurve 322; and the value ZERO would be assigned to the pixel associatedwith point 323 indicating this pixel represents the substrate.

The threshold function for a given printed circuit board is notarbitrary, but is closely related to the particular board and theconfiguration of the tracks thereon. That is to say, the thresholdfunction is determined from an off-line calibration process based onanalyzing one, but preferably, a number of identical actual boards to beinspected. The procedure to obtain the threshold function for aparticular board is listed in FIG. 15 to which reference is now made.Specifically, the procedure may be carried out on a small sample of theentire population of boards and a threshold function derived for eachboard in the sample in order to obtain a composite threshold functionthat is the average of the threshold functions for the sampled boards.

As indicated in FIG. 15, the initial steps for obtaining the thresholdfunction are the same as the steps in inspecting a printed circuit boardin the board is scanned. That is to say, the grey-scale levels arecompensated for non-uniformity, and a grey scale image of the board isobtained and stored for processing in step 323. In step 324, calculatingan ordered pair of numbers for each pixel may occur immediately afterthree grey-scale image of the board is obtained, or may be deferreduntil needed. Regardless, a convolution sign map is computed from thegrey scale map by carrying out the two dimensional convolution processdescribed above as indicated in step 325. So far, except for calculatingthe ordered pair of numbers, the processing carried out is identical towhat has been described in connection with the embodiment shown in FIG.5.

For the purposes of calibration, the convolution sign image is processedin step 326 to obtain a convolution score image or map in which thevalue of each pixel in the convolution sign map is evaluated by takinginto account the convolution signs of its eight neighbors to the endthat the pixel in the convolution score map reflects the a prioriprobability that the pixel is part of a valid edge neighborhood. This isimplemented in a look-up table whose address is the nine bits of theconvolution sign on the 3×3 matrix of pixels. The contents of thelook-up table is computed in a different off-line process that is donebeforehand by human judgment and evaluation of all possible 2⁹combinations. The judgment may be biased on the following criteria: ifthe 3×3 neighborhood can be partitioned into two connected regions, onewith positive convolution signs and the other with negative convolutionsigns, then the configuration represents a valid edge neighborhood.FIGS. 16(a)-(c) represent some configurations for valid edges.Representative configurations that are not valid edge neighborhoods areillustrated in FIGS. 17(a)-(c).

After step 326 is carried out, contours in the convolution score map areevaluated as indicated in step 327. A contour in this context, iscomposed of pairs of connected pairs of contour pixels. A pair ofcontour pixels is a pair of adjacent pixels of opposite sign. Pairs ofcontour pixels are connected if their pixels are adjacent at four sides.

Each of FIGS. 18 and 19 shows a contour. In FIG. 18, contour 328 hasinner contour 329 and outer contour 330. Inner contour 329 is made up ofthe collection of transition pixels of the connected pairs of pixelsmaking up the contour; and outer contour 330 is made of the collectionof the other pixels of the connected pairs.

The calibration process involve grading the contours after they arelocated and the connected pairs of pixels are identified. The grading isa score assigned to the collection of pixels that make up a contouraccording to the probability that the contour is a contour in theobject. The score is based on a ratio of contour length (in pixels) to“bad” indications along the contour. The “bad” indications are describedbelow, suffice it to say at this point that, after the contours havebeen scored, they are divided into three groups according to theirscore. “Good” contours are contours with high scores; “bad” contours arecontours with low scores; and “unsure” contours are contours withintermediate scores. Contour 328 in FIG. 18 is an example of a “good”contour because it does not cross itself like contour 331 shown in FIG.19, which is an example of a “bad” contour.

All the pixels have ordered pairs of numbers associated therewithaccording to step 324. Only those pixels associated with “good” and“bad” contours are mapped into points in thegrey-level-difference/grey-level plane as shown in FIG. 20. However, themapping is done so that “good” contour pixels are separately identifiedfrom “bad” contour pixels. This is shown in FIG. 20 where the “0's” areindicative of pixels associated with “good” contours, and the “X's” areindicative of pixels associated with “bad” contours.

A threshold function is then plotted having the form:

for 0<(g_(avg))<G_(min), T.F.=D_(min)

(g_(avg))>G_(max), T.F.=D_(max)

G_(min<(g) _(avg))<G_(max), T.F.=step variation

More specifically, the threshold function is one that minimizes both thenumber of points associated with pixels from good contours that arebelow the threshold function, and the number of points associated withpixels from bad contours that are above the threshold function. Pointsassociated with pixels from good contours which fall below the thresholdfunction, and points associated with pixels from bad contours which fallabove the threshold function, are termed pixels violations; and thethreshold function that is selected is one that minimizes the number ofpixel violations. In this manner, the values of G_(min), G_(max),D_(min), D_(max), and the step variation between G_(min), G_(max) aredetermined.

As indicated above, the procedure for scoring contours during thecalibration process is based on determining the ratio of contour lengthin pixels to bad indications along the contour. A bad indication may beone of the following: (a) a junction, which is a place where the contourcrosses itself as shown in FIG. 19; (b) an extremely low value ofaverage grey level as computed according to the procedure associatedwith FIG. 13; (c) a bad configuration score as computed according toFIGS. 16 and 17; or (d) large variance of grey levels for either thecontour inner pixels or the contour outer pixels. The scoring procedureis somewhat subjective but may be based on an iterative process in whicha procedure with certain assumptions is carried out and a comparison ismade with the actual period circuit board to evaluate whether theassumptions are valid.

Apparatus for taking into account objects with location dependentthreshold functions is shown in FIG. 21 to which reference is now made.Data from the object being scanned is applied to CCD 44, and correctedfor non-uniformity by compensation circuit 45, as previously described.Corrected grey scale image data produced by circuit 45 is applied inparallel to convolver 47 and to pre-processor 70a.

The convolver circuit, as described above, processes the grey levelimage and produces, for each pixel, a convolution value which is asigned number. In the preferred embodiment, the signed number is a 9-bitsigned integer lying between −256 and +258. The map may be animplementation of difference-of-Gaussians (DOG) computation, whichroughly speaking, shows the amount of total curvature of the grey-levelimage when considered as a topological surface.

Pre-processor 70a operates on the same input as the convolver, andproduces, for each input pixel, two maps: a gradient-enable map, and anadjacency map, both of which are described in detail below. The twocomputation are carried out in the same circuit for reasons ofconvenience, because they share common tasks, mainly the task ofdetermining the four gradients around a given pixel.

Computation of the gradient-enable map is described with reference toFIG. 22. The first task is to compute the absolute values of differencesof grey-levels along the two principal principle and the two diagonaldirections, and from this information, the coordinates g_(avg) andd_(max) for each pixel can be computed as described in connection withFIG. 14. Pixels that are mapped into a point above the thresholdfunction graph are designated as gradient-enable pixels; and all othersas gradient-disable pixels. The gradient-enable map so obtained isstored in memory 71.

Threshold register 201 in FIG. 21 contains thresholds that werepredetermined by the off-line calibration procedure and that will beused in the following stages of the computations, as will be detailedbelow.

Computation of the adjacency map is described with reference to FIGS.23A and 23B. In this map, for every pixel, the neighbors which may issuea “BLACK” recommendation are marked, and similarly the neighbors whichmay issue a “WHITE” recommendation. This map requires eight bits ofdata: four bits to mark those directions which have a steep enoughgradient, and four addition bits to mark the sense of each gradient,increasing or decreasing. Note that then are only two possiblearrangements along any given directions: either the gradient is tooshallow and no recommendation can be issued, or else one of theneighbors in this direction is a potential “WHITE” recommendant and theopposite neighbor a potential “BLACK”. The adjacency map so obtained isstored in memory 71.

The input to convolution processor 200 consists of several image maps asdetailed below; and additional maps are computed during its operation.The final output of processor 200 is a revised convolution map thatagrees with the original convolution map produced by circuit 47 as tocontour pixels, to allow proper interpolation and precise localizationof the contours, and may have revised values in other areas of theimage. The nature of these computations and the resulting maps will nowbe explained with reference to FIG. 24, which explains the preferredconfiguration of convolution processor 200.

The inputs to circuit 200 are: a convolution map from 2D-convolver 47,gradient-enable and adjacency maps from memory 71, a correctedgrey-level map from compensation circuit 45, and thresholds fromthreshold register 201. In subsequent stages of the computation, moremaps are computed. The nature of each map and its derivation procedureare explained below.

The convolution-sign map 251 is produced by simply copying the sign bitfrom the convolution map.

Contour map 253 shown in FIG. 24 is obtained following the proceduredescribed below. A pixel is classified as a contour pixel if itsatisfies the following requirements: (1) it is enabled in thegradient-enable map; (2) it has a neighbor which is gradient-enabled;and (3) the pixel and its neighbor have opposite signs in theconvolution sign map. The map that results has the pixels classifiedinto three categories; “WHITE” contour pixels (contour pixel, negativeconvolution sign). “BLACK” contour pixel (contour pixel, positiveconvolution sign) and “OTHER”, or non-contour pixels.

The optional filtered-contour map 254 (FIG. 24) is obtained by passingthe contour map through a filtering mechanism, if necessary. This isused to remove small specks from the contour map. This may be useful,for example, when the original board is very dirty. The filter mechanismoperates to transform some combination of “WHITE” and “BLACK” pixelsinto class “OTHER”, in accordance with the results of several steps ofshrinking and expanding the map. Such operations are well known and aredescribed, for example, in “Digital Image Processor” by A. Rosenfeld andA. Kak, Academic Press, 1982. Vol. 2. pp. 215-217 which is herebyincorporated by reference.

The high-sure/low-sure map (FIG. 24) is obtained by comparing a pixeltogether with its eight neighbors against two thresholds. This isdetailed in FIG. 25. If the pixel, together with all of its eightneighbors, have lower grey level values than the threshold G_(min), thepixel will be classified as “BLACK”. If the pixel, together with all itseight neighbors have higher grey level values than the thresholdG_(max), the pixel will be classified as “WHITE”. Otherwise, the pixelis classified as “OTHER”.

Mask-image map 255 (FIG. 24) is obtained by combining thehigh-sure/low-sure map with the filtered contour map. That is, a pixelis classified as “WHITE” if it is “WHITE” in the high-sure/low-sure map,or if it is “OTHER” in the high-sure/low-sure map and “WHITE” in thefiltered contour map. A pixel is classified as “BLACK” if it is “BLACK”in the high-sure/low-sure map, or if it is “OTHER” in the high-sure/lowsure map and “BLACK” in the filtered contour map. Finally, a pixel isclassified as “OTHER” only if it is so classified in both maps.

The next stage, as shown in FIG. 24, is painting, the purpose of whichis to ensure that all pixels are eventually classified as either “BLACK”or “WHITE”, with no pixels of class “OTHER” remaining. Once this isachieved, the convolution map is ready to be revised, wherever the colorof a pixel disagrees with the original convolution sign. The resultingrevised map is “paint map” 257.

The operation of painting stages 256 is now described. There are threetypes of painting procedures: adjacency paint (“A”), majority paint(“M”), and tow paint (“T”). The precise sequence of steps is applicationdependent and is empirically determined. In the preferred embodiment,about 10 A steps followed by 2 M steps terminated by one T step areused. Common to all steps is the following operation: a pixel of class“OTHER” will be changed into one of class “BLACK” or “WHITE” providedthat one of its eight neighbors is of this class and that anotherspecific condition is met. This is described in FIG. 26. The specifictest conditions for each of the three paint types is now discussed.

For the adjacency, or “A” type pain step, the condition is as follows:if a neighbor is “WHITE” and the grey level gradient in the direction ofthis neighbor is smaller then some (empirically) predefined constant(negative) number, a “WHITE” recommendation is issued. Similarly, if aneighbor is “BLACK” and the grey level gradient in the direction of thisneighbor is higher than one (empirically) predefined constant (positive)number, a “BLACK” recommendation is issued. The reason here is that if,for example, a neighbor is “white”, and the current pixel is lighterthan this neighbor (in the grey-level map), then it must be “white”also. Finally, if the recommendations of all four directions areunanimous, then they are adopted and the class of the pixel is changedaccordingly. If there is no recommendation, or else, if there areconflicting recommendations, the test is considered failed and the pixelremains of class “OTHER”.

For the majority, or “M” type paint step, the condition for “WHITE” isthis: the number of white neighbors should be larger than that of blackneighbors. The condition for “BLACK” in the reverse condition.

For the tow, or “T” paint step, the resulting pixel will always beclassified as either “BLACK” or “WHITE”. The determination of the classis by the color of the top three neighboring pixels, which have alreadybeen processed in this step. Thus, out of the three there must be amajority of at least two “WHITE” or two “BLACK” pixels. The class of themajority determines the class of the current pixel.

Once painting is completed, revision of the convolution map is the next(and last) step to be carried out prior to interpolation. The procedureis detailed in FIG. 27. If the paint map color agrees with theconvulsion sign, then the original value of the convolution map isoutput. Otherwise, the output is +1 for a “WRITE” “WHITE” pixel in thepaint map, and −1 for a “BLACK” pixel.

The advantages and improved results furnished by the method andapparatus of the present invention are apparent from the foregoingdescription of the preferred embodiment of the invention. Variouschanges and modifications may be made without departing from the spiritand scope of the invention as described in the claims that follow.

What is claimed is:
 1. A process for producing a binary map of an objecthaving a surface each elemental area of which has one or the other oftwo properties, said process comprising: a) scanning said surface toobtain data representative of a grey scale image of said surface with agiven spatial resolution; b) processing said data representative of saidgrey scale image to produce data representative of a map of said objecthaving signed values that identify adjacent elemental areas of saidsurface having different properties, said map having the same spatialresolution as said grey scale image; and c) converting said datarepresentative of a map of said object having signed values to a binarymap of said surface with a spatial resolution higher than the spatialresolution of said grey scale image.
 2. A process according to claim 1wherein data representative of the properties of said surface areobtained during the scanning of said surface, and are utilized duringprocess of converting said data representative of a map said object tosaid binary map.
 3. A process according to claim 2 wherein processing:data includes convolving with a filter function that approximates thesecond derivative of a Gaussian function.
 4. A process according toclaim 2 wherein said data representative of the properties of saidsurface are obtained by comparing the data representative of a greyscale image of said surface with a calibration function.
 5. A processaccording to claim 4 wherein the calibration function is independent ofthe location of elemental areas said surface.
 6. A process according toclaim 4 wherein the calibration function is a fixed threshold.
 7. Aprocess according to claim 4 wherein the calibration function is avariable threshold.
 8. A process according to claim 4 wherein thecalibration function is dependent on the grey scale levels of the greyscale image.
 9. A process according to claim 8 wherein the datarepresentative of the properties of said surface involve a comparison ofthe grey level of a pixel in the grey scale image with the grey levelsof adjacent neighboring pixels said grey scale image.
 10. A processaccording to claim 8 wherein a plurality adjacent neighboring pixels toeach pixel are involved said comparison.
 11. A process according toclaim 10 wherein said comparison is achieved by determining the maximumdifference between the grey scale level of the particular pixel and thegrey scale levels of neighboring pixels, and averaging the grey scalelevels of the particular pixel and the neighboring pixel that producesthe maximum difference.
 12. A process according to claim 4 wherein saidcalibration function is obtained by an off-line calibration process. 13.A process according to claim i 1wherein the process of converting datato said binary map includes assigning states to those binary map pixelswhose states are capable of being classified unambiguously, includingthose binary map pixels that are homologous to elemental areas of saidsurface identified in step (b) of claim 1, and assigning states to theremainder of the binary map pixels according to pre-set rules.
 14. Aprocess according to claim 13 including computing an ordered pair ofnumbers for each pixel in the grey scale image, and assigning atentative state to each pixel in accordance with a threshold functionobtained by an off-line calibration process.
 15. A process for producinga binary map of an object having a surface each elemental area of whichhas one or the other of two properties, said processing comprising: a)scanning said surface to obtain data representative of a grey scaleimage of said surface with a given resolution; b) convolving said datarepresentative of said grey scale image to produce a convolution map ofsaid object having signed values; c) producing from said datarepresentative of said grey scale image, a binary gradient-enable mapfor identifying pairs of contour pixels which are pixels homologous toelemental areas of said surface having different properties, and abinary adjacency map for identifying pixels whose neighboring pixelshave a grey level gradient exceeding a threshold; and using saidgradient-enable map and said adjacency map to create a binary of saidsurface with said given resolution; and e) interpolating said binary mapto form a binary map of said object with a resolution higher than theresolution of said grey scale image.
 16. A process for off-lineproduction of a threshold function comprising: a) scanning an objecthaving a surface each elemental area of which has one or the other oftwo properties to obtain data representative of a grey scale image ofsaid surface; b) processing said grey scale image to obtain datarepresentative of a binary image in which pixels homologous to elementalareas of said surface at which transitions of said properties occur havea given state and the remaining pixels have the opposite state; c)convolving said data representative of said grey scale image to producea convolution score image in which the value of each pixel is dependenton the value of its eight neighbors as determined by a look-up table; d)identify contours in said convolution score image; e) classify eachcontour as being good, bad, or unsure; f) calculate for each pixel inthe grey scale image, an ordered pair of numbers; g) plot the orderedpair of numbers for each contour pixel that in not classified as beingunsure; h) compute a threshold function from the plotted ordered pairsof numbers as a function that minimizes both the number of pointsassociated with pixels from good contours that are below the thresholdfunction, and the number of points associated with pixels from badcontours that are above the threshold function.
 17. A process foranalyzing a surface, comprising: developing a first collection of dataelements, each data element in said first collection of data elementsrepresenting optical characteristics of one of a plurality of areas of asurface to be analyzed; modifying at least some of said data elements insaid first collection of data elements in accordance with opticalcharacteristics of areas adjacent, in at least two non-paralleldirections, to the area represented by the data element being modified;and processing at least some of said modified data elements to provide asecond collection of data elements each data element in said secondcollection representing a spatial location within one of said pluralityof areas of said surface.
 18. The invention of claim 17, whereindeveloping said first collection of data elements further comprises:creating a grey scale bitmap of said surface.
 19. The invention of claim17, wherein modifying some of said data elements in said firstcollection further comprises: applying a filter function to said some ofsaid data elements in said first collection.
 20. The invention of claim17, wherein processing at least some of said modified data elementsfurther comprises: interpolating between said modified data elements tolocate said boundaries.
 21. The invention of claim 17, whereinprocessing said modified data elements further comprises: developing aplurality of binary data elements for each of some of said dataelements.
 22. The invention of claim 17, wherein processing saidmodified data elements further comprises: developing a bitmap of saidsurface, each element of said bitmap representing one of said spatiallocations.
 23. A method for automated optical inspection of anelectrical circuit, comprising: forming a digital grey scale image of anelectrical circuit, said grey scale image having a given grey scaleimage spatial resolution; determining locations of edges within pixelsin said digital grey scale image; producing a digital map of saidelectrical circuit with reference to said edges, said digital map havinga digital map spatial resolution which is greater than said given greyscale spatial resolution; and analyzing the digital map to detectdefects in said electrical circuit.
 24. A method for inspecting anelectrical circuit according to claim 23 wherein forming a digital greyscale image comprises a acquiring measured grey scale data for aplurality of elemental areas on said electrical circuit and applyingsaid measured grey scale data to grey scale image pixels.
 25. A methodfor inspecting an electrical circuit according to claim 24 wherein saiddetermining locations of edges comprises determining a sub-grey scaleimage pixel location of at least part of an edge.
 26. A method forinspecting an electrical circuit according to claim 25 wherein saidproducing a digital map includes providing digital map elements that aresmaller than said grey scale image pixels.
 27. A method for inspectingan electrical circuit according to claim 26 wherein said digital mapelements are binary image pixels.
 28. A method for inspecting apatterned surface, comprising: forming a digital grey scale image of thepatterned surface, said digital grey scale image having a given greyscale image spatial resolution; determining locations of edges withinpixels in said digital grey scale image; producing a digital map of saidelectrical circuit with reference to said edges, said digital map havinga digital map spatial resolution which is greater than said given greyscale image spatial resolution; and analyzing the digital map to detectdefects in the patterned surface.
 29. A method for inspecting apatterned surface according to claim 28 wherein forming a digital greyscale image comprises acquiring measured grey data for a plurality ofelemental areas on said electrical circuit and applying said measuredgrey data to grey scale image pixels.
 30. A method for inspecting apatterned surface according to claim 29 wherein said determininglocations of edges comprises determining a sub-grey scale image pixellocation of at least part of an edge.
 31. A method for inspecting apatterned surface according to claim 30 wherein said producing a digitalmap includes providing digital map elements that are smaller than saidgrey scale image pixels.
 32. A method for inspecting a patterned surfaceaccording to claim 31 wherein said digital map elements are binary imagepixels.
 33. A process for analyzing a patterned surface, comprising:developing a first collection of data elements, each data elementtherein representing one of a plurality of areas of said surface; andprocessing at least some data elements in said first collection inaccordance with an optical characteristic of areas adjacent, in at leasttwo non-parallel directions, to the area represented by a data elementbeing processed to provide a second collection of data elements, eachdata element in said second collection representing a spatial locationwithin one of said plurality of areas of said surface.
 34. A process foranalyzing a patterned surface according to claim 33 wherein saidpatterned surface is a surface of an electrical circuit substrate.
 35. Aprocess for manufacturing an electrical circuit substrate, comprising:depositing at least one conductive member on a surface of an electricalcircuit substrate; developing a first collection of data elements, eachdata element therein representing one of a plurality of areas of saidsurface; modifying at least some of said data elements in said firstcollection of data elements in accordance with optical characteristicsof areas adjacent, in at least two non-parallel directions, to the arearepresented by the data element being modified; processing at least someof said modified data elements to provide a second collection of dataelements each data element in said second collection representing aspatial location within one of said plurality of areas of said surface;analyzing said second collection of data elements to detect defects insaid electrical circuit substrate.
 36. A process for manufacturing anelectrical circuit substrate, comprising: depositing at least oneconductive member on a surface of an electrical circuit substrate;forming a digital grey scale image of said electrical circuit substrate,said digital grey scale image having a given grey scale image spatialresolution; determining locations of edges within pixels in said digitalgrey scale image; producing a digital map of said electrical circuitsubstrate with reference to said edges, said digital map having adigital map spatial resolution which is greater than said given greyscale spatial resolution; and analyzing said digital map to detectdefects in said electrical circuit substrate.
 37. A process formanufacturing an electrical circuit substrate, comprising: depositing atleast one conductive member on a surface of an electrical circuitsubstrate; developing a first collection of data elements, each dataelement wherein representing one of a plurality of areas of saidsurface; processing at least some data elements in said first collectionin accordance with an optical characteristic of areas adjacent, in atleast two non-parallel directions, to the area represented by a dataelement being processed to provide a second collection of data elements,each data element in said second collection representing a spatiallocation within one of said plurality of areas of said surface; andanalyzing said second collection of data elements to detect defects insaid electrical circuit substrate.